package com.tongji.mapper;

import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

public interface ChaxunMapper {
    //盘点记录查询
//    @Select("select \n" +
//            "wms_t_cr_details.chkrptID, wms_t_customer.custName,wms_t_cr_details.detailsEditTime,wms_t_customer.custNote,wms_t_bill_details.detailsEditTime as 'lasttime',wms_t_cr_details.detailsIsDel \n" +
//            "from wms_t_customer\n" +
//            "left join wms_t_bill \n" +
//            "on wms_t_customer.custID = wms_t_bill.customerID \n" +
//            "left join wms_t_bill_details \n" +
//            "on wms_t_bill.billID = wms_t_bill_details.billID\n" +
//            "left join wms_t_cr_details \n" +
//            "on wms_t_bill_details.detailsID = wms_t_cr_details.chkrptID " +
//            "where wms_t_customer.custID = #{custID} " +
//            "and  wms_t_cr_details.detailsEditTime between #{date1} and #{date2}")
    @Select("    <script>\n" +
            "        select\n" +
            "        wms_t_cr_details.chkrptID,\n" +
            "        wms_t_customer.custName,wms_t_cr_details.detailsEditTime,wms_t_customer.custNote,wms_t_bill_details.detailsEditTime\n" +
            "        as 'lasttime',wms_t_cr_details.detailsIsDel\n" +
            "        from wms_t_customer\n" +
            "        left join wms_t_bill\n" +
            "        on wms_t_customer.custID = wms_t_bill.customerID\n" +
            "        left join wms_t_bill_details\n" +
            "        on wms_t_bill.billID = wms_t_bill_details.billID\n" +
            "        left join wms_t_cr_details\n" +
            "        on wms_t_bill_details.detailsID = wms_t_cr_details.chkrptID where 1=1\n" +
            "        <if test=\" custID != null and custID != '' \">\n" +
            "            and wms_t_customer.custID = #{custID}\n" +
            "        </if>\n" +
            "        <if test=\" date1 != null and date1 != '' \">\n" +
            "            <if test=\" date2 != null and date2 != '' \">\n" +
            "                and wms_t_cr_details.detailsEditTime between #{date1} and #{date2}\n" +
            "            </if>\n" +
            "        </if>\n" +
            "    </script>")
    public List<Map<String, Object>> getlog(String custID, String date1, String date2);


//    //盘点记录查询
//    public List<Map<String, Object>> getlog(String custID, String date1, String date2);

}
